package com.jrx.anytxn.transaction.dto.loan;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.jrx.anytxn.transaction.dto.common.CommonReq;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 *  贷款请求（试算及贷款确认等）
 * @author  Administrator
 * date  2019/8/14 0014
 * @version V1.0
 **/
public class LoanReq extends CommonReq implements Serializable {

    /**
     * 产品编号
     */
    @ApiModelProperty(value = "产品编号")
    @Size(max=32, message = "产品编号不能超过32位")
    private String productId;
    /**
     * 贷款金额
     */
    @ApiModelProperty(value = "贷款金额",required = true)
    @NotNull
    @Digits(integer=18, fraction=2,message="贷款金额最多俩位小数且长度不得大于18")
    @DecimalMin(value="0",message="贷款金额必需大于0")
    @JsonSerialize
    private BigDecimal loanAmount;
    /**
     * 还款方式
     */
    @NotEmpty (message = "还款方式不允许空")
    @ApiModelProperty(value = "还款方式",required = true)
    @Size(max=6, message = "产品编号不能超过6位")
    private String amortMethod;
    /**
     * 贷款期数
     */
    @ApiModelProperty(value = "贷款期数",required = true)
    @NotNull (message = "贷款期数不允许为空")
    @Min(value=0,message="贷款期数必须大于0且是正整数")
    private Integer tenor;
    /**
     * 放款日期
     */
    @ApiModelProperty(value = "放款日期",example="2019-01-01")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date loanDate;
    /**
     * 账单日
     */
    @ApiModelProperty(value = "账单日")
    @Range(min=1,max=31,message="账单日必须在1-31内的整数")
    private Integer statementDay;

    /**
     * 商户号
     */
    @ApiModelProperty(value = "商户号")
    @Size(max=32, message = "商户号不能超过32位")
    private String merchantId;

    /**
     * 贷款类型
     */
    @ApiModelProperty(value = "贷款类型")
    @Size(max=1, message = "贷款类型不能超过1位")
    private String productType;

    /**
     * 还款日期
     */
    @ApiModelProperty(value = "还款日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date paymentDate;

    /**
     * 资金源id
     */
    @ApiModelProperty(value = "资金源id")
    @Size(max=6, message = "资金源id不能超过6位")
    private String fundId;

    /**
     * 客户权益id
     */
    @ApiModelProperty(value = "客户权益id")
    private Long custRightId;

    @ApiModelProperty(value = "商户名称")
    private String merchantName;

    public String getProductType() {
        return productType;
    }

    public void setProductType(String productType) {
        this.productType = productType;
    }

    public String getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(String merchantId) {
        this.merchantId = merchantId;
    }


    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public BigDecimal getLoanAmount() {
        return loanAmount;
    }

    public void setLoanAmount(BigDecimal loanAmount) {
        this.loanAmount = loanAmount;
    }

    public String getAmortMethod() {
        return amortMethod;
    }

    public void setAmortMethod(String amortMethod) {
        this.amortMethod = amortMethod;
    }

    public Integer getTenor() {
        return tenor;
    }

    public void setTenor(Integer tenor) {
        this.tenor = tenor;
    }

    public Date getLoanDate() {
        return loanDate;
    }

    public void setLoanDate(Date loanDate) {
        this.loanDate = loanDate;
    }

    public Integer getStatementDay() {
        return statementDay;
    }

    public void setStatementDay(Integer statementDay) {
        this.statementDay = statementDay;
    }

    public Date getPaymentDate() {
        return paymentDate;
    }

    public void setPaymentDate(Date paymentDate) {
        this.paymentDate = paymentDate;
    }

    public String getFundId() {
        return fundId;
    }

    public void setFundId(String fundId) {
        this.fundId = fundId;
    }

    public Long getCustRightId() {
        return custRightId;
    }

    public void setCustRightId(Long custRightId) {
        this.custRightId = custRightId;
    }

    @Override
    public String getMerchantName() {
        return merchantName;
    }

    @Override
    public void setMerchantName(String merchantName) {
        this.merchantName = merchantName;
    }
}
